#ifndef HELPER_H
#define HELPER_H

#include <qobject.h>
#include <qtimer.h>
#include <qdatetime.h>
#include <qlist.h>
#include <qdir.h>

#define SLIDER_TIME   200
#define SLIDER_STEP   10

class cceDirRemoverHelper
{
private:
	cceDirRemoverHelper () {}
public:
  static bool RecursiveRemoveDir (QDir aDir);
};

class cceResizeHelper : public QObject
{
  Q_OBJECT
private:
  QWidget *_widget;
  int     _width;
  int     _height;

private slots:
  void timeout ();

public:
  cceResizeHelper(QWidget *target, int width, int height);
};

class cceSliderHelper : public QObject
{
  Q_OBJECT
private:
  int     _ms;
  QTime   _time;
  QTimer  _timer;
  QWidget *_widget;


private slots:
  virtual void timeout ();

protected:
  cceSliderHelper (QWidget* widget, int time = SLIDER_TIME, int step = SLIDER_STEP);


  virtual void update (QWidget* widget, float a) = 0;

protected slots:
  virtual void clear ();

};

class cceResizeSliderHelper : public cceSliderHelper
{
  Q_OBJECT
private:
  int       _widthFrom;
  int       _heightFrom;
  int       _widthTo;
  int       _heightTo;

protected:
  void update (QWidget* widget, float a);

public:
  cceResizeSliderHelper(QWidget *target, int width, int height, int time = SLIDER_TIME, int step = SLIDER_STEP);

};


class ccePosSliderHelper : public cceSliderHelper
{
  Q_OBJECT
private:
  int     _xFrom;
  int     _yFrom;
  int     _xTo;
  int     _yTo;

protected:
  void update (QWidget* widget, float a);

public:
  ccePosSliderHelper(QWidget *target, int x, int y, int time = SLIDER_TIME, int step = SLIDER_STEP);

};

class QSplitter;
class cceSplitterSliderHelper : public cceSliderHelper
{
  Q_OBJECT
private:
  QList<int>  _sizesFrom;
  QList<int>  _sizesTo;

protected:
  void update (QWidget *widget, float a);

public:
  cceSplitterSliderHelper(QSplitter *target, QList<int> sizes, int time = SLIDER_TIME, int step = SLIDER_STEP);
};


class cceVisibilityHelper : public cceSliderHelper
{
  Q_OBJECT
private:
  bool      _visible;


protected:
  void update(QWidget *o, float a);

public:
  cceVisibilityHelper (QWidget* target, bool visible, int time = SLIDER_TIME, int step = SLIDER_STEP);
};

#endif // HELPER_H
